<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Collocation;
use App\Models\UsersWechat;
use App\Models\ActivityClassif;
use App\Models\Activity;
use App\Models\Banner;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Cache;

class BannerController extends Controller
{


    public function index(Request $request){
        $data ['class'] = ActivityClassif::get();
        return view('admin/activity/banner',$data);
    }

    public function getPageRows(Request $request){
    	$title = intval($request->input('title'));
    	$page = intval($request->input('page',1));

        $query = Activity::where('is_pro',1)->orderBy('id','DESC');
        if ($title) {
            $query->where('title',$title);
        }

        $rows   =  $query->with('class')->paginate(15);
        foreach ($rows as $key => $value) {
             $value->pic = url(unserialize($value->pic1)[0]);
        }
        $data = [
            'rows'=>$rows,
        ];
        return $this->response($data);
    }
}
